package cn.jdy.dzdd.web;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import cn.jdy.common.ctrl.BaseCtrl;
import cn.jdy.dzdd.entity.DzddSecretaryMail;
import cn.jdy.dzdd.service.DzddSecretaryMailService;
import cn.jdy.framework.log.BaseLog;
import cn.jdy.framework.util.DateUtil;
/**
 * @desc 队长信箱操作类
 * @author ningqian
 * @data 2017-6-9
 */

@Controller
@RequestMapping("/dzddMail")
public class DzddSecretaryMailCtrl extends BaseCtrl {
	
	@Autowired
	private DzddSecretaryMailService dzddSecretaryMailService;
	
	/**
	 * 新增
	 * @return
	 */
	@RequestMapping("/index.html")
	public ModelAndView edit() {
		ModelAndView mv = new ModelAndView("/mail/mail.jsp");
		Date datetime = new Date();
		int weekdays = datetime.getDay();
		mv.addObject("weekdays",weekdays);
		
		return mv;
	}



	/**
	 * 保存
	 * @param news
	 * @return
	 * 
	 */
	@RequestMapping("/save")
	public ModelAndView save(DzddSecretaryMail mail) {
		ModelAndView mv = new ModelAndView("/mail/mailOk.jsp");
		try {
			mail.setCreateTime(DateUtil.getCurrentDate(DateUtil._DEFAULT2));
			this.dzddSecretaryMailService.save(mail);
		} catch(Exception e) {
			BaseLog.e(getClass(), "局长信箱保存异常！", e);
		}
		return mv;
	}
	
	
	
	/**
	 * 信访举报界面
	 * @return
	 */
	@RequestMapping("/xfjb.html")
	public ModelAndView xfjb() {
		ModelAndView mv = new ModelAndView("/mail/xfjb.jsp");
		Date datetime = new Date();
		int weekdays = datetime.getDay();
		mv.addObject("weekdays",weekdays);
		
		return mv;
	}

	
}
